<!DOCTYPE html>
<html>
<!-- 培训需求矩阵管理 -->

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <script src="/static/js/common.js"></script>
</head>

<body>
    <div id="app" class="popupW100" v-cloak>
        <el-form label-position="right" :model="Form" status-icon :rules="rules" ref="ruleForm" label-width="100px"
            size="mini">
            <el-row>
                <!-- <el-col :span="11">
                    <div class="elst-select-mini">
                        <el-form-item prop="NameofTrainingNeeds">
                            <el-input type="text" v-model="Form.NameofTrainingNeeds" autocomplete="off" size="mini">
                                <template slot="prepend">
                                    {{TrainingDemandMatrixManagement.NameofTrainingNeeds+mark.m}}
                                </template>
                            </el-input>
                        </el-form-item>
                    </div>
                </el-col> -->

                <!-- <el-col :span="11">
                    <el-col>
                        <div class="elst-select-mini">
                            <el-form-item>
                                <el-input size="mini">
                                    <template slot="prepend">
                                        <div> {{TrainingDemandMatrixManagement.trainingcourse+mark.m}}</div>
                                    </template>
                                    <el-select @visible-change="visibleChange" v-model="Form.trainingcourse" slot="suffix"
                                        :placeholder="TrainingDemandMatrixManagement.trainingcourse">
                                        <el-option label="请选择" value=""></el-option>
                                        <el-option v-for="item in trainingcourse" :label="item.value" :value="item.key">
                                        </el-option>
                                    </el-select>
                                </el-input>
                            </el-form-item>
                        </div>
                    </el-col>
                </el-col> -->
                <el-col :span="11">
                    <el-col>
                        <div class="elst-select-mini">
                            <el-form-item>
                                <el-input size="mini">
                                    <template slot="prepend">
                                        <div> {{TrainingDemandMatrixManagement.post+mark.m}}</div>
                                    </template>
                                    <el-select @visible-change="visibleChange" v-model="Form.post" slot="suffix"
                                        :placeholder="TrainingDemandMatrixManagement.post">
                                        <el-option label="请选择" value=""></el-option>
                                        <el-option v-for="item in post" :label="item.value" :value="item.key">
                                        </el-option>
                                    </el-select>
                                </el-input>
                            </el-form-item>
                        </div>
                    </el-col>
                </el-col>
                <el-col :span="11" offset="2">
                    <el-col>
                        <div class="elst-select-mini">
                            <el-form-item>
                                <el-input size="mini">
                                    <template slot="prepend">
                                        <div> {{TrainingDemandMatrixManagement.SkillsRequirements+mark.m}}</div>
                                    </template>
                                    <el-select @visible-change="visibleChange" v-model="Form.SkillsRequirements" slot="suffix"
                                        :placeholder="TrainingDemandMatrixManagement.SkillsRequirements">
                                        <el-option label="请选择" value=""></el-option>
                                        <el-option v-for="item in SkillsRequirements" :label="item.value"
                                            :value="item.key">
                                        </el-option>
                                    </el-select>
                                </el-input>
                            </el-form-item>
                        </div>
                    </el-col>
                </el-col>
                <el-col :span="24">
                    <div class="elst-select-mini">
                        <el-form-item>
                            <div class="el-input--mini el-input-group">
                                <div class="el-input-group__prepend">
                                    {{TrainingDemandMatrixManagement.MatrixDescription+mark.m}}
                                </div>
                                <el-input class="el-textarea__inner" type="textarea" v-model="Form.MatrixDescription"
                                    autocomplete="off"></el-input>
                            </div>
                        </el-form-item>
                    </div>
                </el-col>
            </el-row>
            <el-row>
                <el-col class="head-tool">
                    <el-button type="primary" @click="UserInput('tj')">{{col.btnAddCourse}}</el-button>
                </el-col>
            </el-row>
            <el-row>
                <el-col>
                    <el-table :data="Form.CourseList" border>
                        <el-table-column prop="course" :label="TrainingDemandMatrixManagement.course">
                        </el-table-column>
                        <el-table-column prop="LastTrainingTime"
                            :label="TrainingDemandMatrixManagement.LastTrainingTime">
                        </el-table-column>
                        <el-table-column prop="TrainingFrequency"
                            :label="TrainingDemandMatrixManagement.TrainingFrequency">
                        </el-table-column>


                        <el-table-column label="操作">
                            <template slot-scope="scope">
                                <el-button @click.native.prevent="deleteRow(scope.$index, Form.CourseList)" type="text"
                                    size="small">
                                    移除
                                </el-button>
                            </template>
                        </el-table-column>
                    </el-table>
                </el-col>
            </el-row>
            <br>


            <el-row type="flex" justify="end">
                <el-form-item>
                    <el-button type="primary" @click="onSubmitForm('ruleForm')">{{col.btnSave}}</el-button>
                    <el-button type="primary" @click="onSubmitForm('ruleForm')">{{col.btnCommit}}</el-button>
                    <el-button type="primary" @click="parent.ListItem.dialogVisible=false">{{col.btnBack}}</el-button>
                </el-form-item>
            </el-row>
        </el-form>

        <el-dialog title="课程添加" :visible.sync="ListItem.dialogVisible" @close='closeDialog' width="50%" height="50%"
            top="10vh" fullscreen="true">
            <iframe ref="iframe" :src="ListItem.InputUrl" style="height:100%;width:100%" frameborder="0"></iframe>
        </el-dialog>
    </div>
    <script type="text/javascript">

        var app = new Vue({

            el: '#app',
            data: {
                //父业传参
                id: '',
                imageUrl: '',
                checked: true,
                value1: '',
                radio: '1',
                ListItem: ListItem,
                trainingcourse: [],
                post: [],
                SkillsRequirements: [],
                QuestionManagementCourseList: [],

                formInline: {
                    model: {
                        NameofTrainingNeeds: '',
                        MatrixDescription: '',
                        trainingcourse: '',
                        post: '',
                        SkillsRequirements: '',


                    },
                    offset: 0,
                    limit: 10
                },
                //业务表单内容
                Form: {
                    id: guidEmpty,
                    NameofTrainingNeeds: '',
                    MatrixDescription: '',
                    trainingcourse: '',
                    post: '',
                    SkillsRequirements: '',
                    CourseList: [],//选项



                },
                //表单验证
                rules: {

                }
            },

            methods: {
                //解決edge下select bug
                visibleChange: function (isVisible) {
                    visibleChange(isVisible)
                },

                //获取分页数据
                GetPageData: function (currentIndex) { GetPageData(this, currentIndex, '/api/TrainingDemandMatrixManagement/GetList') },
                //查询方法
                onSubmit: function () { onSubmit(this); },
                btnUpLoad: function () {
                    this.$message({
                        message: '上传成功',
                        type: 'success'
                    });
                },
                //提交数据
                onSubmitForm: function (formName) {
                    var mythis = this;
                    this.$refs[formName].validate(function (valid) {
                        //验证通过
                        if (valid) {
                            onSubmitForm(this, '/api/TrainingDemandMatrixManagement/Save', mythis.Form);
                        } else {
                            //验证失败
                            return false;
                        }
                    });
                },
                getData: function () {
                    getData(this, '/api/TrainingDemandMatrixManagement/get?id=' + this.id);
                },

                //删除方法
                onDelete: function () { onDelete(this, '/api/TrainingDemandMatrixManagement/DeleteMuti'); },
                //列表选择触发
                UserInputStatistics: function (val, id) { DialogShow(this, val, "TrainingDemandMatrixManagementInputPerson.html", id); },
                handleSelectionChange: function (val) { handleSelectionChange(this, val); },
                handleSelect: function (ev) {
                    console.log(ev);
                },
                //获取分页数据
                GetPageData: function (currentIndex) { GetPageData(this, currentIndex, '/api/TrainingDemandMatrixManagement/GetList') },
                //pagesize改变 触发方法
                handleSizeChange: function (val) { handleSizeChange(this, val); },
                //跳页触发方法
                handleCurrentChange: function (val) { handleCurrentChange(this, val); },
                UserInput: function (val, id) { DialogShow(this, val, "TrainingDemandMatrixManagementInputAdd.html", id); },
                deleteRow: function (index, rows) {
                    rows.splice(index, 1);
                },
            },
            mounted: function () {
                //初始化数据
                this.GetPageData(1);
                //列表高度自适应
                tablehigh(this);
                this.id = getUrlParam("id");
                this.getData();
                //获取下拉菜单内容
                this.trainingcourse = getDicData('83');
                this.post = getDicData('60');
                this.SkillsRequirements = getDicData('w66');
                // this.QuestionManagementCourseList = getDicData('50', list);

            }

        });
    </script>
</body>

</html>